package com.sciyichen.tcpclientbytes;
import java.util.List;
import java.util.function.Consumer;


public interface TcpClientBytesPlugins {
    int crcCcitt(byte[] data, int crc);
    byte[] buildPacketFromJson(String outstr, int checksum);
    Object[] bufferToJson(byte[] pBuffer, int nStart, int nOffset);
    List<String> getAJsonPacketFromSocket(byte[] nBytes, int buffSize);
    public List<String> getDataFromBytesBase64(String nBytesBase64, int buffSize);
    byte[] tcpClientBytes(String host, int port, String base64str, int buffSize, int timeout);
    byte[] tcpClientBytes(String host, int port, String base64str, int buffSize);
    List<String> tcpClientByte(String host, int port, String base64str, int buffSize);

    List<String> tcpClientByte(String host, int port, String base64str, int buffSize, int timeout);
    void tcpClient(String ip, int port);
    public boolean isConnected() ;
    public void connect(String host, int port,int outtime,  Consumer<String>  successCallback,  Consumer<String>  errorCallback) ;
        public void sendBytes(byte[] data, Consumer<String> successCallback, Consumer<String> errorCallback);
    public void sendBase64Str(String base64Str, Consumer<String> successCallback, Consumer<String> errorCallback);
    public void send(String data, Consumer<String> successCallback, Consumer<String> errorCallback);
    public void close(Consumer<String> successCallback, Consumer<String> errorCallback);
    public void setStringCallback(Consumer<String> callback) ;
    public void setDataByteArrayCallback(Consumer<byte[]> callback) ;
    public void setDataByteArrayBase64StrCallback(Consumer<String> callback) ;
    public  String bytesToHex(byte[] bytes) ;

    public  byte[] hexToBytes(String hex);
//    private void startReceiveThread() ;
}